package State;

import org.apache.flink.contrib.streaming.state.RocksDBStateBackend;
import org.apache.flink.runtime.state.filesystem.FsStateBackend;
import org.apache.flink.runtime.state.memory.MemoryStateBackend;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

public class State_FaultTolerance {
    public static void main(String[] args) throws Exception {
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
        env.setParallelism(1);

        //状态后端的配置
        env.setStateBackend(new MemoryStateBackend());//存到内存
        env.setStateBackend(new FsStateBackend(""));//存储到文件
        env.setStateBackend(new RocksDBStateBackend(""));//序列化后存储到本地的RocksDB

    }
}
